// 单词规律

var wordPattern = function (pattern, s) {
  const words = s.split(" ");
  const map = new Map();
  if (pattern.length !== words.length) return false;
  for (let index of words.keys()) {
    const word = words[index];
    const pat = pattern.charAt(index);
    if (words.indexOf(word) !== pattern.indexOf(pat)) return false;
  }
  return true;
};
